package com.niiwoo.civet.trade.configuration;

import com.niiwoo.civet.trade.constant.RabbitConstant;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class NoviceTaskRecordConfiguration {
    @Bean
    public Exchange NoviceTaskRecordExchange() {
        return new DirectExchange(RabbitConstant.Exchange.NOVICE_TASK_RECORD, true, true);
    }

    @Bean
    public Queue NoviceTaskRecordQueue() {
        return new Queue(RabbitConstant.Queue.NOVICE_TASK_RECORD, true);
    }

    @Bean
    public Binding NoviceTaskRecordBinding() {
        return BindingBuilder.bind(NoviceTaskRecordQueue())
                .to(NoviceTaskRecordExchange())
                .with(RabbitConstant.RoutingKey.NOVICE_TASK_RECORD).noargs();
    }
}
